/**
 * 
 */
package org.nobject.common.swing.g;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;

/**
 * GFileChooser
 *
 * @author bianrongjun
 * @version 1.0
 */
public class GFileChooser extends JFileChooser implements IG{

	/**
	 * 构造函数 
	 */
	public GFileChooser() {
		super();
		this.core=new GComponent();
	}

	/**
	 * 构造函数 
	 * @param container
	 * @param name
	 * @param filePath
	 * @param preferredSize
	 * @param fileFilter
	 * @param actionListener
	 */
	public GFileChooser(Container container,String name,String filePath,Dimension preferredSize,FileFilter fileFilter,ActionListener actionListener){
		this();
		if(name!=null) this.setName(name);
		if(filePath!=null) this.setSelectedFile(new File(filePath));
		if(fileFilter!=null) this.addChoosableFileFilter(fileFilter);
		if(actionListener!=null) this.addActionListener(actionListener);
		this.setPreferredSize(preferredSize);
		container.add(this);
		this.setBounds(0, 0, 406, 477);
	}
	
	/** GComponent */
	private GComponent core;
	public GComponent getGCore() {return core;}
	
	
	public void paintChildren(Graphics g) {core.paintChildren(g);super.paintChildren(g);}
}
